package com.arm.controller.product;

import com.arm.controller.WechatBaseController;
import com.arm.service.ProductService;
import com.arm.tools.result.ResultObj;
import com.arm.tools.result.ReturnCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Baggio on 2019-1-8.
 */
@RestController
@RequestMapping("product")
public class ProductController extends WechatBaseController {
@Autowired
    ProductService productService;

    @GetMapping(value = "/list")
    public ResultObj logOut() {
        ResultObj resultObj = new ResultObj();
        try {

            resultObj.setData(productService.getProductList(null));

        } catch (Exception e) {
            e.printStackTrace();
            resultObj.setCode(ReturnCode.FAIL.getCode());
            resultObj.setMsg(e.getMessage());
        }
        return resultObj;
    }
}
